package com.lbw.singleton;

import java.util.concurrent.TimeUnit;

/**
 * @author lbw
 * @version 1.0
 * @date 2021/9/4 23:00
 */
public class Client {


    public static void main(String[] args) {
        /*Singleton1 s11 = Singleton1.getInstance();
        Singleton1 s12 = Singleton1.getInstance();
        System.out.println(s11 == s12);*/

        /*Singleton2 s21 = Singleton2.getInstance();
        Singleton2 s22 = Singleton2.getInstance();
        System.out.println(s21 == s22);*/
        //
        // Singleton3 s31 = Singleton3.getInstance();
        // Singleton3 s32 = Singleton3.getInstance();
        // // System.out.println(s31 == s32);


        // Singleton4 s41 = Singleton4.getInstance();
        // Singleton4 s42 = Singleton4.getInstance();
        // System.out.println(s31 == s32);
        for (int i = 0; i < 100; ++i) {
            new Thread(() -> {
                System.out.println(Singleton3.getInstance());
            }).start();
        }
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        
    }
}
